$(function(){
    $('#frm_login').submit(
        function(e){
            var a = $('<div class="error_login"></div>');
            $('body').append(a);
            e.preventDefault();
            var data = $(this).serialize();
            $.post('http://localhost/pewol/login/verify', data,
                function(response) {
                    if(!response.success){ 
                    $('.error_login').html(response.message).dialog({modal: true,
                    show:'slide', 
                    title:'Error',
                    buttons : { 
                        OK: function(){
                            $(this).dialog('close');
                        }
                    }     
                    });
                    } else {
                        location.replace('http://localhost/pewol/login/view');
                    }
            }, 'json');
        }
    );